package com.cgsd.heyu.adapter;

import android.content.Context;
import android.graphics.Color;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.library.adapter.BaseMultiItemAdapter;
import com.android.library.adapter.ViewHolder;
import com.cgsd.heyu.R;
import com.cgsd.heyu.entity.TabEntity;

import java.util.List;

/**
 * @author xiaoxing
 * Description 首页tab导航栏
 * CreateData: 2020/11/3
 */
@Deprecated
public class CustomHomeTabAdapter extends BaseMultiItemAdapter<TabEntity> {
    private int selectPosition;

    public int getSelectPosition() {
        return selectPosition;
    }

    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
    }

    public CustomHomeTabAdapter(Context mContext, List<TabEntity> mDatas) {
        super(mContext, mDatas);
    }

    @Override
    protected int muItemViewType(int position, TabEntity tabEntity) {
        return 0;
    }

    @Override
    protected int muLayoutId(int itemType) {
        return R.layout.item_home_tab;
    }

    @Override
    public void convert(ViewHolder holder, TabEntity tabEntity, int position) {
        TextView tvTitle = holder.getView(R.id.tv_title);
        ImageView ivImage = holder.getView(R.id.iv_image);
        tvTitle.setText(tabEntity.title);
        ivImage.setImageResource(tabEntity.imgResId);
        if (position == selectPosition) {
            tvTitle.setTextColor(Color.parseColor("#000000"));
            ivImage.setSelected(true);
        } else {
            tvTitle.setTextColor(Color.parseColor("#ADADAD"));
            ivImage.setSelected(false);
        }

    }
}
